using System;
using System.Collections.Generic;
using System.Text;
using Decav.Gatsb.Mobile;
using System.IO;
using Decav.Reality;

namespace Decav.Gatsb.MobileProviders
{
    /// <summary>
    /// Parses a message from a phone using the <see cref="SprintServiceProvider"/>.
    /// </summary>
    public class SprintMessageParser : IPhoneMessageParser
    {
        #region IPhoneMessageParser Members

        public MobileMessage ParseMailMessage(SmtpMailHeader header, StreamReader messageStream)
        {
            if (header.ContentType != null && header.ContentType.Type == ContentType.MultipartMixed.Type)
            {
                throw new NotImplementedException();
            }
            else
            {
                string body = messageStream.ReadToEnd().Trim();
                string telNum = header.Sender.ToString().Split('@')[0];

                new SmsMessage(header.Recipient, header.Sender, new PhoneNumber(telNum),
                    header.DateReceived, body);
            }

            throw new NotImplementedException();
        }

        #endregion
    }
}
